package testes;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import codigoBase.MyLinearSearch;

public class MyLinearSearchTeste {


	private MyLinearSearch myLS;
	
	@Before
	public void setUp(){
		myLS = new MyLinearSearch();
		Assert.assertNotNull(myLS);
	}
	
	@Test
	public void testLinerSearch() {
		int[] arr = {1,2,10,5,4};
		int key1 = 2;
		int key2 = 1;
		int key3 = 4;
		
		Assert.assertEquals(1, MyLinearSearch.linerSearch(arr, key1));
		Assert.assertEquals(0, MyLinearSearch.linerSearch(arr, key2));
		Assert.assertEquals(4, MyLinearSearch.linerSearch(arr, key3));
		Assert.assertEquals(-1, MyLinearSearch.linerSearch(arr, 8));
	}

}
